﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using VisionCloud.Core.Model.Ms;
using VisionCloud.Domain.Extension;
using VisionCloud.Domain.Repository.Interface.Ms;

namespace VisionCloud.Domain.Repository.Implement.Ms
{
    public class MsManualMeasureReportRepository : BaseRepository<MsManualMeasureReport>, IMsManualMeasureReportRepository
    {
        public async Task<List<MsManualMeasureReport>> GetDataByTaskId(Guid taskId)
        {
            return await (
           from h in Db.MsManualMeasureReports
           where h.TaskId == taskId
           select h).AsNoTracking().OrderByDescending(x => x.CreatedDate).ThenByDescending(y => y.UpdatedDate).ToListAsync().ConfigureAwait(false);
        }

        // 允许ReadUncommitted
        //using (var txn = new TransactionScope(TransactionScopeOption.Required,
        //    new TransactionOptions
        //    {
        //        IsolationLevel = IsolationLevel.ReadUncommitted
        //    }))
        //{
        //}
    }
}